package thread.exception;

/**
 * 捕获运行时异常
 *
 * @author lwmzzz
 * @version 1.0
 * @date 2021/5/16 21:06
 */
public class Test02 {
    public static void main(String[] args) {
        Thread.setDefaultUncaughtExceptionHandler((Thread thread, Throwable e) -> {
            System.out.println(thread.getName() + " 线程发生了异常： " + e.getMessage());
        });

        new Thread(() -> {
            int i = 11 / 0;
        }).start();
    }
}
